home *** CD-ROM | disk | FTP | other *** search
/ Workbench Add-On / Workbench Add-On - Volume 1.iso / Dev / Oberon / source / amiga / Expansion.mod < prev    next >
Text File  |  1995-06-29  |  6KB  |  224 lines

  1. (***************************************************************************
  2.  
  3.      $RCSfile: Expansion.mod $
  4.   Description: Interface to expansion.library
  5.  
  6.    Created by: fjc (Frank Copeland)
  7.     $Revision: 3.8 $
  8.       $Author: fjc $
  9.         $Date: 1995/06/04 23:13:14 $
  10.  
  11.   Includes Release 40.15
  12.  
  13.   (C) Copyright 1985-1993 Commodore-Amiga, Inc.
  14.       All Rights Reserved
  15.  
  16.   Oberon-A interface Copyright © 1994-1995, Frank Copeland.
  17.   This file is part of the Oberon-A Interface.
  18.   See Oberon-A.doc for conditions of use and distribution.
  19.  
  20. ***************************************************************************)
  21.  
  22. <* STANDARD- *>
  23.  
  24. MODULE [2] Expansion;
  25.  
  26. IMPORT SYS := SYSTEM, Kernel, e := Exec, d := Dos, c := Config, s := Sets;
  27.  
  28.  
  29. (*
  30. **      $VER: expansion.h 36.7 (28.5.90)
  31. **
  32. **      External definitions for expansion.library
  33. *)
  34.  
  35. CONST
  36.  
  37.   expansionName * = "expansion.library";
  38.  
  39. (* flags for the AddDosNode() call *)
  40.  
  41.   startProc *  = 0;
  42.  
  43. (*
  44. **      $VER: expansionbase.h 36.15 (21.10.91)
  45. **
  46. **      Definitions for the expansion library base
  47. *)
  48.  
  49.  
  50. (* BootNodes are scanned by dos.library at startup.  Items found on the
  51.    list are started by dos. BootNodes are added with the AddDosNode() or
  52.    the V36 AddBootNode() calls. *)
  53.  
  54. TYPE
  55.  
  56.   BootNodePtr * = POINTER TO BootNode;
  57.   BootNode * = RECORD (e.NodeBase)
  58.     base *       : e.Node;
  59.     flags *      : s.SET16;
  60.     deviceNode * : e.NodePtr;
  61.   END; (* BootNode *)
  62.  
  63.  
  64. (* expansion.library has functions to manipulate most of the information in
  65.    ExpansionBase.  Direct access is not permitted.  Use FindConfigDev()
  66.    to scan the board list. *)
  67.  
  68. TYPE
  69.  
  70.   ExpansionBasePtr * = POINTER TO ExpansionBase;
  71.   ExpansionBase * = RECORD (e.LibraryBase)
  72.     libNode *   : e.Library;
  73.     flags -     : s.SET8;         (* read only (see below) *)
  74.     private01   : e.UBYTE;        (* private *)
  75.     private02   : e.ULONG;        (* private *)
  76.     private03   : e.ULONG;        (* private *)
  77.     private04   : c.CurrentBinding; (* private *)
  78.     private05   : e.List;         (* private *)
  79.     mountList * : e.List;         (* contains struct BootNode entries *)
  80.     (* private *)
  81.   END; (* ExpansionBase *)
  82.  
  83. CONST
  84.  
  85. (* error codes *)
  86.   ok *           = 0;
  87.   lastBoard *    = 40;  (* could not shut him up *)
  88.   noExpansion *  = 41;  (* not enough expansion mem; board shut up *)
  89.   noMemory *     = 42;  (* not enough normal memory *)
  90.   noBoard *      = 43;  (* no board at that address *)
  91.   badMem *       = 44;  (* tried to add bad memory card *)
  92.  
  93. (* Flags *)
  94.  
  95.   ebClogged *     = 0;       (* someone could not be shutup *)
  96.   ebShortMem *    = 1;       (* ran out of expansion mem *)
  97.   ebBadMem *      = 2;       (* tried to add bad memory card *)
  98.   ebDosFlag *     = 3;       (* reserved for use by AmigaDOS *)
  99.   ebKickBack33 *  = 4;       (* reserved for use by AmigaDOS *)
  100.   ebKickBack36 *  = 5;       (* reserved for use by AmigaDOS *)
  101.  
  102. (* If the following flag is set by a floppy's bootblock code, the initial
  103.    open of the initial shell window will be delayed until the first output
  104.    to that shell.  Otherwise the 1.3 compatible behavior applies. *)
  105.  
  106.   ebSilentStart * = 6;
  107.  
  108. (* Magic kludge for CC0 use *)
  109.   ebStartCC0 * = 7;
  110.  
  111. (**-- Library Base variable --------------------------------------------*)
  112.  
  113. VAR
  114.  
  115.   base *  : ExpansionBasePtr;
  116.  
  117.  
  118. (**-- Library Functions ------------------------------------------------*)
  119.  
  120. (*
  121. **      $VER: expansion_protos.h 39.0 (31.10.91)
  122. *)
  123.  
  124. (* --- functions in V33 or higher (distributed as Release 1.2) ---*)
  125.  
  126. PROCEDURE AddConfigDev* [base,-30]
  127.   ( configDev [8] : c.ConfigDevPtr );
  128.  
  129. (* --- functions in V36 or higher (distributed as Release 2.0) ---*)
  130.  
  131. PROCEDURE AddBootNode* [base,-36]
  132.   ( bootPri    [0] : LONGINT;
  133.     flags      [1] : s.SET32;
  134.     deviceNode [8] : d.DeviceNodePtr;
  135.     configDev  [9] : c.ConfigDevPtr )
  136.   : BOOLEAN;
  137.  
  138. (* --- functions in V33 or higher (distributed as Release 1.2) ---*)
  139.  
  140. PROCEDURE AllocBoardMem* [base,-42]
  141.   ( slotSpec [0] : e.ULONG );
  142. PROCEDURE AllocConfigDev* [base,-48] ()
  143.   : c.ConfigDevPtr;
  144. PROCEDURE AllocExpansionMem* [base,-54]
  145.   ( numSlots  [0] : e.ULONG;
  146.     slotAlign [1] : e.ULONG )
  147.   : e.APTR;
  148. PROCEDURE ConfigBoard* [base,-60]
  149.   ( board     [8] : e.APTR;
  150.     configDev [9] : c.ConfigDevPtr );
  151. PROCEDURE ConfigChain* [base,-66]
  152.   ( baseAddr [8] : e.APTR );
  153. PROCEDURE FindConfigDev* [base,-72]
  154.   ( oldConfigDev [8] : c.ConfigDevPtr;
  155.     manufacturer [0] : LONGINT;
  156.     product      [1] : LONGINT )
  157.   : c.ConfigDevPtr;
  158. PROCEDURE FreeBoardMem* [base,-78]
  159.   ( startSlot [0] : e.ULONG;
  160.     slotSpec  [1] : e.ULONG );
  161. PROCEDURE FreeConfigDev* [base,-84]
  162.   ( configDev [8] : c.ConfigDevPtr );
  163. PROCEDURE FreeExpansionMem* [base,-90]
  164.   ( startSlot [0] : e.ULONG;
  165.     numSlots  [1] : e.ULONG );
  166. PROCEDURE ReadExpansionByte* [base,-96]
  167.   ( board  [8] : e.APTR;
  168.     offset [0] : e.ULONG )
  169.   : e.UBYTE;
  170. PROCEDURE ReadExpansionRom* [base,-102]
  171.   ( board     [8] : e.APTR;
  172.     configDev [9] : c.ConfigDevPtr );
  173. PROCEDURE RemConfigDev* [base,-108]
  174.   ( configDev [8] : c.ConfigDevPtr );
  175. PROCEDURE WriteExpansionByte* [base,-114]
  176.   ( board  [8] : e.APTR;
  177.     offset [0] : e.ULONG;
  178.     byte   [1] : e.UBYTE );
  179. PROCEDURE ObtainConfigBinding* [base,-120] ();
  180. PROCEDURE ReleaseConfigBinding* [base,-126] ();
  181. PROCEDURE SetCurrentBinding* [base,-132]
  182.   ( currentBinding [8] : c.CurrentBindingPtr;
  183.     bindingSize    [0] : e.UWORD );
  184. PROCEDURE GetCurrentBinding* [base,-138]
  185.   ( currentBinding [8] : c.CurrentBindingPtr;
  186.     bindingSize    [0] : e.UWORD )
  187.   : e.ULONG;
  188. PROCEDURE MakeDosNode* [base,-144]
  189.   ( parmPacket [8] : e.APTR )
  190.   : d.DeviceNodePtr;
  191. PROCEDURE AddDosNode* [base,-150]
  192.   ( bootPri    [0] : LONGINT;
  193.     flags      [1] : s.SET32;
  194.     deviceNode [8] : d.DeviceNodePtr )
  195.   : BOOLEAN;
  196.  
  197. (* --- functions in V36 or higher (distributed as Release 2.0) ---*)
  198.  
  199. (* --- REMEMBER: You are to check the version BEFORE you use this ! --- *)
  200. PROCEDURE ExpansionResrved26* [base,-156] ();
  201. PROCEDURE WriteExpansionWord* [base,-162]
  202.   ( board  [8] : e.APTR;
  203.     offset [0] : LONGINT;
  204.     word   [1] : INTEGER);
  205.  
  206.  
  207. (**-- Library Base variable --------------------------------------------*)
  208.  
  209. <*$LongVars-*>
  210.  
  211. (**-----------------------------------*)
  212. PROCEDURE* [0] CloseLib (VAR rc : LONGINT);
  213.  
  214. BEGIN (* CloseLib *)
  215.   IF base # NIL THEN e.CloseLibrary (base) END
  216. END CloseLib;
  217.  
  218. BEGIN
  219.   base := SYS.VAL ( ExpansionBasePtr,
  220.                     e.OpenLibrary (expansionName, e.libraryMinimum) );
  221.   IF base = NIL THEN HALT (100) END;
  222.   Kernel.SetCleanup (CloseLib)
  223. END Expansion.
  224.